package com.gitee.wsl.doc.prosemirror.model.dom.parser.rule

import com.gitee.wsl.doc.prosemirror.model.attr.Attrs

// Fields that may be present in both [tag](#model.TagParseRule) and
// [style](#model.StyleParseRule) parse rules.
interface BaseParseRule {
    // Can be used to change the order in which the parse rules in a
    // schema are tried. Those with higher priority come first. Rules
    // without a priority are counted as having priority 50. This
    // property is only meaningful in a schema—when directly
    // constructing a parser, the order of the rule array is used.
    val priority: Int?

    // By default, when a rule matches an element or style, no further
    // rules get a chance to match it. By setting this to `false`, you
    // indicate that even when this rule matches, other rules that come
    // after it should also run.
    val consuming: Boolean?

    // When given, restricts this rule to only match when the current
    // context—the parent nodes into which the content is being
    // parsed—matches this expression. Should contain one or more node
    // names or node group names followed by single or double slashes.
    // For example `"paragraph/"` means the rule only matches when the
    // parent node is a paragraph, `"blockquote/paragraph/"` restricts
    // it to be in a paragraph that is inside a blockquote, and
    // `"section//"` matches any position inside a section—a double
    // slash matches any sequence of ancestor nodes. To allow multiple
    // different contexts, they can be separated by a pipe (`|`)
    // character, as in `"blockquote/|list_item/"`.
    val context: String?

    // The name of the mark type to wrap the matched content in.
    var mark: String?

    // When true, ignore content that matches this rule.
    val ignore: Boolean?

    // When true, finding an element that matches this rule will close
    // the current node.
    val closeParent: Boolean?

    // Attributes for the node or mark created by this rule. When
    // `getAttrs` is provided, it takes precedence.
    var attrs: Attrs?

    fun hasSkip(): Boolean
}